/*package casamento.util;

import java.sql.SQLException;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.bean.SessionScoped;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.convert.FacesConverter;

import casamento.Bean.EstabelecimentoBean;
import casamento.DAO.EstabelecimentoDAO;

@FacesConverter(value= "autoCompleteConverter")
public class AutoCompleteConverter implements Converter {

	public static List<EstabelecimentoBean> listaNomes;
	public List<EstabelecimentoBean> selectEstabelecimento;

	public List<EstabelecimentoBean> listarNomesConverter()
			throws ClassNotFoundException, SQLException {
		EstabelecimentoDAO dao = new EstabelecimentoDAO();
		listaNomes = dao.listar();

		return listaNomes;

	}

	public Object getAsObject(FacesContext facesContext, UIComponent component,
			String submittedValue) {
		
		if (submittedValue.trim().equals("") ) {
			return null;
		} else {
			try {
				
				String nome = submittedValue;
						
						for (EstabelecimentoBean empresa : listaNomes) {
							if (empresa.getNome().equals(nome)) {
								return empresa;
							}
						}
				
			} catch (NumberFormatException exception) {
				throw new ConverterException(new FacesMessage(
						FacesMessage.SEVERITY_ERROR, "Conversion Error",
						"Not a valid player"));
			}
		}
		
		return null;
	
	}

	public String getAsString(FacesContext facesContext, UIComponent component,
			Object value) {

		if (value == null || value.equals("")) {
			return "";
		} else {
			return String.valueOf(((EstabelecimentoBean) value).getNome());
		}
	}
}
*/